UPDATE
tmall_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z+cc5bsLbexU5NZ7vhJ2wCPTiwU8Q/9I5EcZUY3hHAg='
WHERE
key_id = 'ff88fe5cb61a11bc5d5be1f80f28df248418f2874120337da81e25c5f6c7014b'
AND (
token = 'Z+cc5bsLbexU5NZ7vhJ2wCPTiwU8Q/9I5EcZUY3hHAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)