UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YNQkJwvQaIT+RGj3DSQDtdGkJUUAAukff3UwGyosZCQ='
WHERE
key_id = 'd62fb08ee3e224d5aed02d11181d741c0e89b4658e7a95a12b600a903ee5d576'
AND (
token = 'YNQkJwvQaIT+RGj3DSQDtdGkJUUAAukff3UwGyosZCQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)