UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b17Cy8SXrUxxDFDn9iKRxRt8dUR2Ug9nP3bWWd29c1s=' 
WHERE 
  key_id = '5ee64728098d7d277a91c5517143116706e1d65ecf3094f44b76e0b198a56a21' 
  AND (
    token = 'b17Cy8SXrUxxDFDn9iKRxRt8dUR2Ug9nP3bWWd29c1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026