UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BwPT6YyuYDs0QPvWrztzvU4iQJdoc4epQK29EPs7A1c=' 
WHERE 
  key_id = '7a62df81660245b5ab244c16bb8666a4fc1131ddff3cc37b60d4d73959bc97c1' 
  AND (
    token = 'BwPT6YyuYDs0QPvWrztzvU4iQJdoc4epQK29EPs7A1c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037