UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nwvqXQShESc7hzlszn5BPsf8J6rcEBOiG4NlnDwiQ/U='
WHERE
key_id = '311a495a7a45120a9ce0b4765b9cbc9ea2653fb6dfc029931a88dc8eb06570a1'
AND (
token = 'nwvqXQShESc7hzlszn5BPsf8J6rcEBOiG4NlnDwiQ/U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)