UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BWA39mkkaQIkRfpADqHuL/Ei9YT+14LxwOceOL0wsDA=' 
WHERE 
  key_id = 'b31b443e8a0877013f2dfcc8788b592e42eb40af80aa84e5c9f0b3e160cc91a8' 
  AND (
    token = 'BWA39mkkaQIkRfpADqHuL/Ei9YT+14LxwOceOL0wsDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044