UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0Qr5pubrcyDU6FSW+zFYqRpHt0hCshm6s2SHzZKp41o='
WHERE
key_id = 'c3ce87d44e4367f2adc865172298ad42ef478c2a3c14870d4c64267ce581ae7a'
AND (
token = '0Qr5pubrcyDU6FSW+zFYqRpHt0hCshm6s2SHzZKp41o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)