UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jgmje97QI2WeV7sXzYIVv5lzqJUnrNZLDSVM0krR+3Y='
WHERE
key_id = 'b367899507a52a9158cc9f3756bcdb0ed86a464704958d5639a176c6e3ff4c4b'
AND (
token = 'jgmje97QI2WeV7sXzYIVv5lzqJUnrNZLDSVM0krR+3Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)