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