UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GR0GkiG3Fh538KVfC54pW9qbvU9oOUmSm5bFfi3vUr8='
WHERE
key_id = '0c738a2a16172726ae636f7d26876022ae578e1a5bc7254714cffcebea2816c6'
AND (
token = 'GR0GkiG3Fh538KVfC54pW9qbvU9oOUmSm5bFfi3vUr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)