UPDATE
q_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Rshd7LuWIuthgfr8Uh3Y5Zu2fJ8wXLDwt4ZB4gEmAVw='
WHERE
key_id = '8f96e252631cbd118d10c1c624b6791be22b767dc3c5339091a6976f9d6c047c'
AND (
token = 'Rshd7LuWIuthgfr8Uh3Y5Zu2fJ8wXLDwt4ZB4gEmAVw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)