UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BMGLYgxpmOQTUJaC+rgBj2n+BvPrf4FK1uNFPz/hjj0=' 
WHERE 
  key_id = 'aab4a03c44d2906563a2793a62d53586945a9ef35baf493b2e8f590403152d3e' 
  AND (
    token = 'BMGLYgxpmOQTUJaC+rgBj2n+BvPrf4FK1uNFPz/hjj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023