UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N8/O9NCfYMgREW75lwJf+ln6oDRoLpjTxE8NzkfZNHE='
WHERE
key_id = '297e0d4e54ae0be4c0ae3c2e8e8f5910c9efef600a143e1c491c0ea185b54e5e'
AND (
token = 'N8/O9NCfYMgREW75lwJf+ln6oDRoLpjTxE8NzkfZNHE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)