UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xYpdG2lAxlNpICG8JiFiIGrMSvubL15ITn1DDJaikD8='
WHERE
key_id = '2a50abd88373798ce03a569986cabd32ba62e93025e50d387ef16305aeaa6782'
AND (
token = 'xYpdG2lAxlNpICG8JiFiIGrMSvubL15ITn1DDJaikD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)