UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fYyzkcA9Ckq9M7Bn4ddrJLANWa4DTNjpK55Itv05f78=' 
WHERE 
  key_id = '917881f83f909f74936dc0f5e636bf2c40913c5538360b4602e6bab862eb904a' 
  AND (
    token = 'fYyzkcA9Ckq9M7Bn4ddrJLANWa4DTNjpK55Itv05f78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047