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