UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BD+m3NRJXB1vHhzGsPO4LAJP4lEbpuNLj6ipBWYVqGw=' 
WHERE 
  key_id = '4edf6342d62c5de0aeb37ac6a1c1348cad32920ddca4dfe6fcb00c0aaf739074' 
  AND (
    token = 'BD+m3NRJXB1vHhzGsPO4LAJP4lEbpuNLj6ipBWYVqGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032