UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'msBJueRNe0TrPfRojqQzCc9phiTOn+GzTDWs/naKiyk='
WHERE
key_id = '42ea1f99b06e059ea0d9e031a8a24259a96fbbf383f7283d03ab736652b2be69'
AND (
token = 'msBJueRNe0TrPfRojqQzCc9phiTOn+GzTDWs/naKiyk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)