UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7ABgpBvt7InF7b5nORdLeW7T1v63DjR1THVCiRdrte4='
WHERE
key_id = '8331ecff7d6bf9bbd45399addd4c039e4ffdcc3bbcc439d3ae65c82f2ea6867f'
AND (
token = '7ABgpBvt7InF7b5nORdLeW7T1v63DjR1THVCiRdrte4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)