UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YJDtWc7LFfgTs75ySZXa8/ohpusaEgPYl8VX6NYyHyY='
WHERE
key_id = 'def01e688e8c1dbb745ec73228f91147dbf37c3e4cb98ec96c3da776b6892e8b'
AND (
token = 'YJDtWc7LFfgTs75ySZXa8/ohpusaEgPYl8VX6NYyHyY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)