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