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

Query time 0.00021