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