UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BXsTmptGGQelXHAKxEFNUORgvFMqUpYxWZht1cdjNXY='
WHERE
key_id = '9a6fc78037d2d591bf648f8581a67042d8faa03d23a9878a22a57dce31268065'
AND (
token = 'BXsTmptGGQelXHAKxEFNUORgvFMqUpYxWZht1cdjNXY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)