UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e0RwRCqL0ChEwKdzjC1noWE3RqZzA6Q7j+Evd+kR0Ys='
WHERE
key_id = 'd7f239173813352341bf504804a9bda1d9bff0a7770e91da76f907a2a54d8eb6'
AND (
token = 'e0RwRCqL0ChEwKdzjC1noWE3RqZzA6Q7j+Evd+kR0Ys='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)