UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0vDqPic9b29GjiDZp6nmxIZnxVCSngf7J73ueftvpKk=' 
WHERE 
  key_id = '3421012c3c61ba39cd5acbb1da969307faa3cafef68ef6969da50772bde4a4b8' 
  AND (
    token = '0vDqPic9b29GjiDZp6nmxIZnxVCSngf7J73ueftvpKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028