UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hMYcCvZvcDwrpf2hpmwY79jtw4rykgEvVfFyUBG0XaU=' 
WHERE 
  key_id = '790ef7d1df6e9b88ba31a8f257c02fdff7de201d830db8b69122265193578f39' 
  AND (
    token = 'hMYcCvZvcDwrpf2hpmwY79jtw4rykgEvVfFyUBG0XaU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027