UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'clJ9WZo4BIAyNYAQ1PoONunvKMqjvird55EOBVkszfA='
WHERE
key_id = 'ec7d1ef9b7b12a872c4ee0745c5f0d0a5bce653a3732f12acd6609f4e9e5b7e2'
AND (
token = 'clJ9WZo4BIAyNYAQ1PoONunvKMqjvird55EOBVkszfA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)