UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lw0LLqc++K7DJ9wjeUEDp8W90P3GRDWTb6MjoYHRH+E=' 
WHERE 
  key_id = '0332303e2d760192599ba9f200b2b1c78c2e6f05e6269765414b0ea10a95c14f' 
  AND (
    token = 'lw0LLqc++K7DJ9wjeUEDp8W90P3GRDWTb6MjoYHRH+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037