UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2ilr/FcLMJ54UqnkIEonuA88Lbj5hLnk2ORYzIZVzrE=' 
WHERE 
  key_id = 'cebd256621aa7c4066e8932135d141c1167fe9f3b66b77a43e63e62e0cf6016d' 
  AND (
    token = '2ilr/FcLMJ54UqnkIEonuA88Lbj5hLnk2ORYzIZVzrE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029