UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aUeLfSMI+guzCTMe7xQdT33ZhwX0Sy5hThhEd/cei6c=' 
WHERE 
  key_id = '7874414920976b5d51d0a52019229c0780501ce9c30e0a1be7ed41259cc10a11' 
  AND (
    token = 'aUeLfSMI+guzCTMe7xQdT33ZhwX0Sy5hThhEd/cei6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030