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